package com.dslu.fx.service.impl;

import com.dslu.fx.dao.ProdDao;
import com.dslu.fx.domain.ProdDO;
import com.dslu.fx.service.ProdService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;



@Service
public class ProdServiceImpl implements ProdService {
	@Autowired
	private ProdDao prodDao;
	
	@Override
	public ProdDO get(Integer id){
		return prodDao.get(id);
	}
	
	@Override
	public List<ProdDO> list(Map<String, Object> map){
		return prodDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return prodDao.count(map);
	}
	
	@Override
	public int save(ProdDO prod){
		return prodDao.save(prod);
	}
	
	@Override
	public int update(ProdDO prod){
		return prodDao.update(prod);
	}
	
	@Override
	public int remove(Integer id){
		return prodDao.remove(id);
	}
	
	@Override
	public int batchRemove(Integer[] ids){
		return prodDao.batchRemove(ids);
	}

    @Override
    public PageInfo<ProdDO> getProdList(Map<String, Object> map) {
        PageHelper.startPage(map); //开始起始页
        List<ProdDO> list = prodDao.getProdList(map); // 获取数据
        PageInfo<ProdDO> page = new PageInfo<>(list); // 实例化PageInfo
        return page;
    }

    @Override
    public ProdDO getOne(Map<String, Object> map){
        return prodDao.getOne(map);
    }
	
}
